<style>
    div.small-box{max-width:240px;}
    div[id^=del_tag_]{max-width:240px;}
    div.card-body div.content_body{border-bottom:1px solid #ccc;margin-bottom:10px;}
    div.card-body:last-child{}
</style>
<section class="content">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">案例列表
                        <a class="btn" href="{:U('add')}">
                            <i class="fa fa-plus"></i> 添加
                        </a>
                    </h3>
                    <div class="card-tools">
                        <div class="input-group input-group-sm" style="width: 150px;">
                            <input type="hidden" name="s" value="<?php echo MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME; ?>"/>
                            <input type="text" name="keywords" class="form-control float-right" placeholder="请输入关键字">
                            <div class="input-group-append">
                                <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card-body">
                    <foreach name="list" item="v">
                        <div class="row col-lg-12 col-12 content_body">
                            <div class="row col-lg-12 col-12 font-title">
                                <h3>{$v.name|replace_keywords=I('get.keywords'),###}</h3>{:get_more_link(array(
                                    U('save',array('id'=>$v['id'])) => '编辑',
                                    U('del',array('id'=>$v['id'])) => '删除',
                                ))}
                            </div>
                            <div class="row col-lg-12 col-12 font-content">
                                <foreach name='v.project' item='tv'>
                                    <div class="col-lg-3 col-6" id="del_tag_{$tv.id}">
                                        <div class="small-box">
                                            <div class="inner">
                                                <h3>{$tv.info.name}</h3>{:get_more_link(array(
                                        U('Product/project_save',array('id'=>$tv['info']['id'])) => '编辑',
                                        "javascript:del_tag('".$tv['id']."')" => '删除',
                                    ))}
                                    <?php 
                                        if(empty($tv['file'])){ ?>
                                            <img src="IMG/no_img.png" style="height:200px;width:200px;"/>
                                        <?php } else {
                                            ?>
                                                <foreach name="tv.file" item="tv" key="tk">
                                                    <if condition="$tk lt 1">
                                                        <img src="Upload/{$tv.file_content.thumb_200}" style="height:200px;width:200px;"/>
                                                    </if>
                                                </foreach>
                                            <?php
                                        }
                                    
                                    
                                    ?>
                                                <foreach name="v.img_link" item="vv" key="kk">
                                                    <if condition="$kk lt 1">
                                                        <img src="Upload/{$vv.file_content.thumb_200}" style="height:200px;width:200px;"/>
                                                    </if>
                                                </foreach>
                                            </div>
                                        </div>
                                    </div>
                                </foreach>
                            </div>
                        </div>
                    </foreach><?php /*
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                            <tr>
                                <th width="100" >ID</th>
                                <th width="10%">缩略图</th>
                                <th>分类名称</th>
                                <th width="15%">添加时间</th>
                                <th width="20%">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                        <foreach name="list" item="v">
                            <tr>
                                <td >{$v.id}</td>
                                <td>
                                    <foreach name="v.img_link" item="vv" key="kk">
                                        <if condition="$kk lt 3">
                                            <img src="Upload/{$vv.file_content.thumb_100}" style="height:40px;margin-right:3px;"/>
                                        </if>
                                    </foreach>
                                </td>
                                <td>{$v.name|replace_keywords=I('get.keywords'),###}</td>
                                <td>{$v.ad_time|date="Y-m-d H:i:s",###}</td>
                                <td>
                                    <div class="button-group">
                                        <a class="btn" href="{:U('save',array('id'=>$v['id']))}"><i class="fa fa-edit"></i>修改</a> 
                                        <a class="btn" href="javascript:void(0)" onclick="return del('{:U('del',array('id'=>$v['id']))}')"><i class="fa fa-trash-o fa-lg"></i>删除</a>
                                    </div>
                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table> */?>
                </div>
                <div class="card-footer clearfix">
                    {$page}
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
    function del_tag(tid) {
        $.get("{:U('Tag/delete')}", {tid: tid, status:98}, function (d) {
            if (d.status == 1) {
                $('#del_tag_' + tid).remove();
            }
        });
    }
    function del(url) {
        method.msg_layer({
            type:"layer-spread",
            title:"您确定要删除吗?",
            content:"<div>您确定要删除本条内容吗？一旦删除将不可恢复</div>",
            area:["300px","auto"],
            btn:["取消","提交"],
            btn_yes:function(){
                $.get(url,function(d){
                    if(d.status == 0){
                        var obj={
                            type:"layer-shake",
                            title:"结果",
                            content:"<div>" + d.info + '</div>',
                            area:["300px","auto"]
                        };
                        method.msg_layer(obj);
                    } else {
                        var obj={
                            type:"layer-spread",
                            title:"结果",
                            content:"<div>" + d.info + '</div>',
                            area:["300px","auto"]
                        };
                        method.msg_layer(obj);
                        setTimeout(function(){
                            window.location.href = d.url;
                        },800)
                    }
                });
            }
        });
    }
    $(function(){
        $('.fenlei a').html('×');
    });
</script>